const Service = require('egg').Service;
class ApplesService extends Service{
  async getApples(){
    const apples = await this.app.mysql.select('Apples');;
    let data = {
      isPicker: false,
      apples: apples
    };
    return data;
  }
  async getDetail(id){
    let data =  await this.app.mysql.get('Apples', { id: id });
    return data;
  }
  async updateApple(data){
    const result = await this.app.mysql.update('Apples', data);
    return result;
  }
  async deleteApple(id){
    const result = await this.app.mysql.delete('Apples', {id: id});
    return result;
  }
  async addApple(data){
    const result = await this.app.mysql.insert('Apples', data);
    return result;
  }
}
module.exports = ApplesService;
